package com.android.nearshop.app.activity.shop;

import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.text.Html;
import android.widget.ImageView;
import android.widget.TextView;

import com.android.nearshop.R;
import com.android.nearshop.app.activity.common.TemplateActivity;
import com.android.nearshop.app.activity.search.SearchActivity;
import com.android.nearshop.app.widget.TitleBar;
import com.android.nearshop.app.widget.TitleBar.OnTitleClickListener;
import com.android.nearshop.util.Constant;
import com.android.nearshop.util.ImageLoader;
import com.android.nearshop.util.ImageLoader.Imager;

/**
 * 商家介绍
 * @author huangyue
 *
 */
public class ShopInfoActivity extends TemplateActivity {
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		
		setContentView(R.layout.activity_shop_info);
		
		Intent intent = getIntent();
		String imageURI = intent.getStringExtra(Constant.TAG_DETAIL_SHOPIMAGE);
		String content = intent.getStringExtra(Constant.TAG_DETAIL_SHOPCONTENT);
		
		ImageView image = (ImageView) findViewById(R.id.shop_image);
		// 缓存图片[zhaohua]
		ImageLoader.getInstance().DisplayImage(
		        new Imager(imageURI, image, 97, R.drawable.default_detail_pic));
		
		TextView contentView = (TextView) findViewById(R.id.shop_content);
		contentView.setText(Html.fromHtml(content));
	}
	
	protected void setupTitleBar(TitleBar titleBar) {
		titleBar.setLeftImage(0);
		titleBar.setRightVisible(false);
		titleBar.setTitle(R.string.shop_detail_info);
		
		titleBar.setOnTitleClickListener(new OnTitleClickListener() {
			
			public void onRightClick() {
			}
			
			public void onLeftClick() {
				finish();
			}
		}, true, false);
	}
}
